
var window = window || {};

window["webpackJsonp"] = require("../../bundle.js");
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{

/***/ 247:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global, __stringify__) {/* mpx inject */ global.currentModuleId = "m209317be"
global.currentResource = "/Users/KK/Documents/Hummer&Tenon/mpx-master/examples/mpx-todoMVC/src/components/todo.mpx"
global.currentCtor = Component
global.currentResourceType = 'component'
global.currentCtorType = "component"
global.currentSrcMode = "wx"
/* mpx inject */ global.currentInject = {
  moduleId: "m209317be",
  render: function () {
    this._c("todoCls", this.todoCls);

    this._c("mpxShow", this.mpxShow) || this._c("mpxShow", this.mpxShow) === undefined ? '' : 'display:none;';

    this._c("todo.done", this.todo.done);

    this._c("todo.done", this.todo.done) ? 'toggle checked' : 'toggle';

    this._c("todo.text", this.todo.text);

    this._c("todo.text", this.todo.text);

    this._c("editing", this.editing);

    __stringify__.stringifyStyle("", {
      display: this._c("editing", this.editing) ? '' : 'none'
    });

    this._r();
  }
};
/* harmony import */ var _babel_loader_node_modules_mpxjs_webpack_plugin_lib_selector_type_script_index_0_todo_mpx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(249);
/* empty/unused harmony star reexport */global.currentModuleId
/* script */


/* styles */
__webpack_require__(250)

/* json */
__webpack_require__(251)

/* template */
__webpack_require__(252)


/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1), __webpack_require__(248)))

/***/ }),

/***/ 248:
/***/ (function(module, exports, __webpack_require__) {

function objectKeys(obj) {
  if (true) {
    return Object.keys(obj);
  } else { var item, i, shift, stack, inKey, key, objStr, shiftMap, stackMap, keys; }
}

function genRegExp(str, flags) {
  if (true) {
    return new RegExp(str, flags);
  } else {}
}

function extend(target, from) {
  var fromKeys = objectKeys(from);

  for (var i = 0; i < fromKeys.length; i++) {
    var key = fromKeys[i];
    target[key] = from[key];
  }

  return target;
}

function concat(a, b) {
  return a ? b ? a + ' ' + b : a : b || '';
}

function isObject(obj) {
  return obj !== null && typeof obj === 'object';
}

function likeArray(arr) {
  if (true) {
    return Array.isArray(arr);
  } else {}
}

function isDef(v) {
  return v !== undefined && v !== null;
}

function stringifyClass(value) {
  if (!value) return '';

  if (likeArray(value)) {
    return stringifyArray(value);
  }

  if (isObject(value)) {
    return stringifyObject(value);
  }

  if (typeof value === 'string') {
    return value;
  }

  return '';
}

function stringifyArray(value) {
  var res = '';
  var stringified;

  for (var i = 0; i < value.length; i++) {
    if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
      if (res) res += ' ';
      res += stringified;
    }
  }

  return res;
}

var mpxDashReg = genRegExp('(.+)MpxDash$');

function stringifyObject(value) {
  var res = '';
  var objKeys = objectKeys(value);

  for (var i = 0; i < objKeys.length; i++) {
    var key = objKeys[i];

    if (value[key]) {
      if (res) res += ' ';

      if (mpxDashReg.test(key)) {
        key = hump2dash(mpxDashReg.exec(key)[1]);
      }

      res += key;
    }
  }

  return res;
}

function hump2dash(value) {
  var reg = genRegExp('[A-Z]', 'g');
  return value.replace(reg, function (match) {
    return '-' + match.toLowerCase();
  });
}

function dash2hump(value) {
  var reg = genRegExp('-([a-z])', 'g');
  return value.replace(reg, function (match, p1) {
    return p1.toUpperCase();
  });
}

function parseStyleText(cssText) {
  var res = {};
  var listDelimiter = genRegExp(';(?![^(]*[)])', 'g');
  var propertyDelimiter = genRegExp(':(.+)');
  var arr = cssText.split(listDelimiter);

  for (var i = 0; i < arr.length; i++) {
    var item = arr[i];

    if (item) {
      var tmp = item.split(propertyDelimiter);

      if (tmp.length > 1) {
        var k = dash2hump(tmp[0].trim());
        res[k] = tmp[1].trim();
      }
    }
  }

  return res;
}

function genStyleText(styleObj) {
  var res = '';
  var objKeys = objectKeys(styleObj);

  for (var i = 0; i < objKeys.length; i++) {
    var key = objKeys[i];
    var item = styleObj[key];
    res += hump2dash(key) + ':' + item + ';';
  }

  return res;
}

function mergeObjectArray(arr) {
  var res = {};

  for (var i = 0; i < arr.length; i++) {
    if (arr[i]) {
      extend(res, arr[i]);
    }
  }

  return res;
}

function normalizeDynamicStyle(value) {
  if (!value) return {};

  if (likeArray(value)) {
    return mergeObjectArray(value);
  }

  if (typeof value === 'string') {
    return parseStyleText(value);
  }

  return value;
}

module.exports = {
  stringifyClass: function (staticClass, dynamicClass) {
    if (typeof staticClass !== 'string') {
      return console.log('Template attr class must be a string!');
    }

    return concat(staticClass, stringifyClass(dynamicClass));
  },
  stringifyStyle: function (staticStyle, dynamicStyle) {
    var normalizedDynamicStyle = normalizeDynamicStyle(dynamicStyle);
    var parsedStaticStyle = typeof staticStyle === 'string' ? parseStyleText(staticStyle) : {};
    return genStyleText(extend(parsedStaticStyle, normalizedDynamicStyle));
  }
};

/***/ }),

/***/ 249:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(170);
/* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _mpxjs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(243);






Object(_mpxjs_core__WEBPACK_IMPORTED_MODULE_1__["createComponent"])({
  properties: {
    todo: Object,
    index: Number
  },
  data: {
    editing: false
  },
  computed: {
    todoCls: function todoCls() {
      var cls = 'li todo';
      if (this.todo.done) {
        cls += ' completed';
      }
      if (this.editing) {
        cls += ' editing';
      }
      return cls;
    }
  },
  methods: babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _store_index__WEBPACK_IMPORTED_MODULE_2__["default"].mapMutations(['editTodo']), {
    toggleTodo: function toggleTodo() {
      _store_index__WEBPACK_IMPORTED_MODULE_2__["default"].commit('toggleTodo', { index: this.index });
    },
    setEditing: function setEditing() {
      this.editing = true;
    },
    deleteTodo: function deleteTodo() {
      _store_index__WEBPACK_IMPORTED_MODULE_2__["default"].commit('deleteTodo', { index: this.index });
    },
    doneEdit: function doneEdit(e) {
      var value = e.detail.value.trim();
      if (!value) {
        this.deleteTodo();
      } else if (this.editing) {
        this.editTodo({
          index: this.index,
          value: value
        });
      }
      this.editing = false;
    },
    cancelEdit: function cancelEdit() {
      this.editing = false;
    }
  })
});

/***/ }),

/***/ 250:
/***/ (function(module, exports) {

// removed by extractor

/***/ }),

/***/ 251:
/***/ (function(module, exports) {

// removed by extractor

/***/ }),

/***/ 252:
/***/ (function(module, exports) {

// removed by extractor

/***/ })

},[[247,1]]]);